<script src="//cdn.rawgit.com/dcodeIO/protobuf.js/6.X.X/dist/protobuf.js"></script>
<script type="text/javascript">
        var WSMessage;
        var wsmessage;
        var buffer;
        protobuf.load("./pb.proto", function (err, root) {
            if (err) throw err;
            WSMessage = root.lookup("wenlipackage.WSMessage");
            wsmessage = WSMessage.create({ id: "1", content: "hello", sender: "web", time: new Date().getTime() });
            buffer = WSMessage.encode(wsmessage).finish();
        });
</script>